#pragma once


#include "role.h"

namespace cocos2d
{
	class CCParallaxNode;
	class CCTMXTiledMap;
	class CCFollow;
	class CCLayer;
}

class Size
{
public:
	int width;
	int height;
	
	Size(int w,int h)
	{
		width = w;
		height = h;
	}
};

class MapInfo
{
public:
};

class Map
{
public:
	enum
	{
		k_background_layer_2 = 0,
		k_background_layer_1,

		k_ground_layer,
		k_player_layer,				//layer 

		k_frontground_layer2,
		k_frontground_layer1,

		k_max_layer,
	};

	static Map* Create(MapInfo& info);
	static void Destory(Map* map);

	Map(void);
	virtual ~Map(void);

	bool InitWithInfo(MapInfo& info);
	void AddRole(Role* role);
	void RemoveRole(Role* role);
	void SetPos(Pos& pos);
	Pos  GetPos();
	Size GetSize();
	void FollowRole(Role* role);
	bool CanMoveTo(Pos& pos);
public:
	cocos2d::CCNode* GetNode();
	cocos2d::CCNode* GetMapLayer(int layer);
	cocos2d::CCNode* GetRoleLayer();
private:
	cocos2d::CCParallaxNode* map_node_;
	cocos2d::CCFollow*		follower_;
	cocos2d::CCNode*		map_layers_[k_max_layer];
	MapInfo				map_info_;
};

